<template>
    <div>
        <mt-tabbar v-model="selected" fixed>
            <mt-tab-item id="index">
                <img slot="icon" src="@/assets/images/home.png">
                首页
            </mt-tab-item>
            <mt-tab-item id="user">
                <img slot="icon" src="@/assets/images/user.png">
                用户
            </mt-tab-item>
        </mt-tabbar>
    </div>
</template>

<script>
export default {
    name: 'Tabbar',
    data() {
        return {
            selected: ''
        }
    },
    watch: {
        selected(val) {
            if(val === 'index') {
                this.$router.replace('/index')
            }
            if(val === 'user') {
                this.$router.replace('/user')
            }
        }
    }
}
</script>

<style>

</style>